a7f310ced43dc9bdc08d27c5c412908207d4fa1b,drools-core/src/main/java/org/drools/agent/impl/KnowledgeAgentImpl.java,KnowledgeAgentImpl,buildResourceMapping,#Package#Resource#boolean#,506

Before Change


                if ( autoDiscoverResource ) {
                    resource = function.getResource();
                }
                this.addDefinitionMapping( resource,
                                           function,
                                           true );
            }
        }
    }

After Change


                                         + rule );
                }
                if ( autoDiscoverResource ) {
                    resource = rule.getResource();
                }

                if ( isNewDefinition( resource, rule ) ) {
                    this.addDefinitionMapping( resource,
                                               rule,
                                               true );
                }
            }

            for ( Process process : pkg.getRuleFlows().values() ) {
                if ( resource == null ) {
                    this.listener.debug( "KnowledgeAgent no resource mapped for process="
                                         + process );
                }
                if ( autoDiscoverResource ) {
                    resource = ((ResourcedObject) process).getResource();
                }

                if ( isNewDefinition( resource, process ) ) {
                    this.addDefinitionMapping( resource,
                                               process,
                                               true );
                }
            }

            for ( TypeDeclaration typeDeclaration : pkg.getTypeDeclarations().values() ) {
                if ( resource == null ) {
                    this.listener.debug( "KnowledgeAgent no resource mapped for type="
                                         + typeDeclaration );
                }
                if ( autoDiscoverResource ) {
                    resource = typeDeclaration.getResource();
                }

                if ( isNewDefinition( resource, typeDeclaration ) ) {
                    this.addDefinitionMapping( resource,
                                               typeDeclaration,
                                               true );
                }
            }

            for ( Function function : pkg.getFunctions().values() ) {
                if ( resource != null && !((InternalResource) resource).hasURL() ) {
                    this.listener.debug( "KnowledgeAgent no resource mapped for function="
                                         + function );
                }
                if ( autoDiscoverResource ) {
                    resource = function.getResource();
                }
                if ( isNewDefinition( resource, function ) ) {
                    this.addDefinitionMapping( resource,
                                               function,
                                               true );
                }
            }
        }